<template>
<div>
<div>
  <template>
    <div style="padding-right: 30px">
      <Form :model="formItem" :label-width="120">
        <Row>
          <Col span="12">
            <FormItem label="编号：">
              <Input v-model="formItem.aac001" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="姓名：">
              <Input v-model="formItem.aac003" disabled></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="公民身份号码：">
              <Input v-model="formItem.aac002" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="性别：">
              <Select v-model="formItem.aac004" disabled>
                <Option :value="item.value"  v-for="(item,index) in sexList" :key="index">{{item.label}}</Option>
              </Select>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="出生日期：">
              <Input v-model="formItem.aac006" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="民族：">
              <Select v-model="formItem.aac005" disabled>
                <Option :value="item.value"  v-for="(item,index) in nationList" :key="index">{{item.label}}</Option>
              </Select>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="年龄：">
              <Input v-model="formItem.age" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="户口性质：">
<!--              <Input v-model="formItem.aac009" disabled></Input>-->
              <Select v-model="formItem.aac009" disabled>
                <Option :value="item.value"  v-for="(item,index) in relationList" :key="index">{{item.label}}</Option>
              </Select>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="所在地区代码：">
              <Input v-model="formItem.aaa120" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="所在地区：">
              <Input v-model="formItem.aaa121" disabled></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="残疾类别：">
<!--              <Input v-model="formItem.adc013" disabled></Input>-->
              <Select v-model="formItem.adc013" disabled>
                <Option :value="item.value"  v-for="(item,index) in disList" :key="index">{{item.label}}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="残疾等级：">
<!--              <Input v-model="formItem.adc015" disabled></Input>-->
              <Select v-model="formItem.adc015" disabled>
                <Option :value="item.value"  v-for="(item,index) in levelList" :key="index">{{item.label}}</Option>
              </Select>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="残疾证号：">
              <Input v-model="formItem.adc016" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="户籍地址：">
              <Input v-model="formItem.aac019" disabled></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="现住址：">
              <Input v-model="formItem.aac01a" ></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="邮政编码：">
              <Input v-model="formItem.aac01b" ></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="固定电话：">
              <Input v-model="formItem.aac01c" ></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="移动电话：">
              <Input v-model="formItem.aac01d" ></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="电子邮箱：">
              <Input v-model="formItem.aac01e" ></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="工作单位：">
              <Input v-model="formItem.aab004" disabled></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="联系人姓名：">
              <Input v-model="formItem.adc01a" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="联系人身份证号：">
              <Input v-model="formItem.adc01b" disabled></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="与其关系：">
<!--              <Input v-model="formItem.adc01c" disabled></Input>-->
              <Select v-model="formItem.adc01c" disabled>
                <Option :value="item.value"  v-for="(item,index) in relationList" :key="index">{{item.label}}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="联系人固定电话：">
              <Input v-model="formItem.adc01d" disabled></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="联系人移动电话：">
              <Input v-model="formItem.adc01e" disabled></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="联系人家庭住址：">
              <Input v-model="formItem.adc01f" disabled></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="申请时间：">
<!--              <Input v-model="formItem.agc111" ></Input>-->
<!--              <DatePicker format="yyyy-MM-dd" type="date" v-model="formItem.agc111"></DatePicker>-->
              <DatePicker v-model="formItem.agc111" format="yyyy年MM月dd日" type="date" style="width: 200px"></DatePicker>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="自理程度：">
<!--              <Input v-model="formItem.agc114" ></Input>-->
              <Select v-model="formItem.agc114">
                <Option :value="item.value"  v-for="(item,index) in cdList" :key="index">{{item.label}}</Option>
              </Select>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="银行名称：">
              <Input v-model="formItem.aac081"></Input>
            </FormItem>
          </Col>
          <Col span="12">
            <FormItem label="账号：">
              <Input v-model="formItem.aac082"></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="12">
            <FormItem label="账户名：">
              <Input v-model="formItem.aac083"></Input>
            </FormItem>
          </Col>
        </Row>
        <Row>
          <Col span="13">
            <FormItem style="text-align: right">
              <Button type="primary" @click="submit()">保存</Button>
            </FormItem>
          </Col>
        </Row>
      </Form>
    </div>
  </template>
</div>
</div>
</template>

<script>
import { disabilityInfoVerify, repetitionApply } from '@/api/common'
export default {
  name: 'disability',
  props: {
    personinfo: Object,
    cardno: String,
    info: Object
    // formInfo: Object
    // cardId: {
    //   type: String,
    //   default: () => {
    //     return ''
    //   }
    // }
  },
  data () {
    return {
      nationList: [
        { value: '01', label: '汉族' },
        { value: '02', label: '蒙古族' },
        { value: '03', label: '回族' },
        { value: '04', label: '藏族' },
        { value: '05', label: '维吾尔族' },
        { value: '06', label: '苗族' },
        { value: '07', label: '彝族' },
        { value: '08', label: '壮族' },
        { value: '09', label: '布依族' },
        { value: '10', label: '朝鲜族' },
        { value: '11', label: '满族' },
        { value: '12', label: '侗族' },
        { value: '13', label: '瑶族' },
        { value: '14', label: '白族' },
        { value: '15', label: '土家族' },
        { value: '16', label: '哈尼族' },
        { value: '17', label: '哈萨克族' },
        { value: '18', label: '傣族' },
        { value: '19', label: '黎族' },
        { value: '20', label: '傈傈族' },
        { value: '21', label: '佤族' },
        { value: '22', label: '畲族' },
        { value: '23', label: '高山族' },
        { value: '24', label: '拉祜族' },
        { value: '25', label: '水族' },
        { value: '26', label: '东乡族' },
        { value: '27', label: '纳西族' },
        { value: '28', label: '景颇族' },
        { value: '29', label: '柯尔克孜族' },
        { value: '30', label: '土族' },
        { value: '31', label: '达翰尔族' },
        { value: '32', label: '仫佬族' },
        { value: '33', label: '羌族' },
        { value: '34', label: '布朗族' },
        { value: '35', label: '撒拉族' },
        { value: '36', label: '毛南族' },
        { value: '37', label: '仡佬族' },
        { value: '38', label: '锡伯族' },
        { value: '39', label: '阿昌族' },
        { value: '40', label: '普米族' },
        { value: '41', label: '塔吉克族' },
        { value: '42', label: '怒族' },
        { value: '43', label: '乌孜别克族' },
        { value: '44', label: '俄罗斯族' },
        { value: '45', label: '鄂温克族' },
        { value: '46', label: '德昂族' },
        { value: '47', label: '保安族' },
        { value: '48', label: '裕固族' },
        { value: '49', label: '京族' },
        { value: '50', label: '塔塔尔族' },
        { value: '51', label: '独龙族' },
        { value: '52', label: '鄂伦春族' },
        { value: '53', label: '赫哲族' },
        { value: '54', label: '门巴族' },
        { value: '55', label: '珞巴族' },
        { value: '56', label: '基诺族' },
        { value: '97', label: '其他' }
      ],
      sexList: [
        { value: '1', label: '男' },
        { value: '2', label: '女' }
      ],
      hkList: [
        { value: '1', label: '农业户口' },
        { value: '2', label: '非农业户口' }
      ],
      disList: [
        { value: '1', label: '视力' },
        { value: '2', label: '听力' },
        { value: '3', label: '言语' },
        { value: '4', label: '肢体' },
        { value: '5', label: '智力' },
        { value: '6', label: '精神' },
        { value: '7', label: '多重' }
      ],
      levelList: [
        { value: '1', label: '一级' },
        { value: '2', label: '二级' },
        { value: '3', label: '三级' },
        { value: '4', label: '四级' }
      ],
      relationList: [
        { value: '1', label: '配偶' },
        { value: '2', label: '子' },
        { value: '3', label: '女' },
        { value: '4', label: '(外)孙(子/女)' },
        { value: '5', label: '父母' },
        { value: '6', label: '(外)祖父母' },
        { value: '7', label: '兄/弟/姐/妹' },
        { value: '8', label: '其他' }
      ],
      cdList: [
        { value: '01', label: '完全自理' },
        { value: '02', label: '半自理' },
        { value: '03', label: '完全不能自理' }
      ],
      formItem: {
        // AAC001: '', // 编号  主键
        // AAC003: '', // 姓名
        // AAC002: '', // 公民身份证号
        // AAC004: '', // 性别
        // AAC006: '', // 出生日期
        // AGE: '', // 年龄
        // AAC005: '', // 民族
        // AAC009: '', // 户籍性质
        // AAA120: '', // 所在地区编码
        // AAA121: '', // 所在地区
        // ADC013: '', // 残疾类别
        // ADC015: '3', // 残疾等级
        // ADC016: '', // 残疾证号
        // AAC019: '', // 户籍地址
        // AAC01A: '', // 现地址
        // AAC01B: '', // 邮政编码
        // AAC01C: '', // 固定电话
        // AAC01D: '', // 移动电话
        // AAC01E: '', // 电子邮箱
        // AAB004: '', // 工作单位
        // ADC01A: '', // 联系人姓名
        // ADC01B: '', // 联系人身份证号
        // ADC01C: '', // 与其关系
        // ADC01D: '', // 联系人固定电话
        // ADC01E: '', // 联系人移动电话
        // ADC01F: '', // 联系人家庭住址
        // AGC111: '', // 申请时间
        // AGC114: '', // 自理程度
        /// ///////
        aac001: '', // 编号  主键
        aac003: '', // 姓名
        aac002: '', // 公民身份证号
        aac004: '', // 性别
        aac006: '', // 出生日期
        age: '', // 年龄
        aac005: '', // 民族
        aac009: '', // 户籍性质
        aaa120: '', // 所在地区编码
        aaa121: '', // 所在地区
        adc013: '', // 残疾类别
        adc015: '', // 残疾等级
        adc016: '', // 残疾证号
        aac019: '', // 户籍地址
        aac01a: '', // 现地址
        aac01b: '', // 邮政编码
        aac01c: '', // 固定电话
        aac01d: '', // 移动电话
        aac01e: '', // 电子邮箱
        aab004: '', // 工作单位
        adc01a: '', // 联系人姓名
        adc01b: '', // 联系人身份证号
        adc01c: '', // 与其关系
        adc01d: '', // 联系人固定电话
        adc01e: '', // 联系人移动电话
        adc01f: '', // 联系人家庭住址
        agc111: '', // 申请时间
        agc114: '', // 自理程度
        aac081: '', // 银行名称
        aac082: '', // 账号
        aac083: ''// 账户名
      },
      cardNo: '',
      name: '',
      codeinfo: {},
      forminfo: {}
    }
  },
  methods: {
    init (obj) {
      console.log(obj, '@@@')
      if (obj === '{}' || obj === undefined) {
        console.log('无值')
        let params = {
          cardno: this.cardNo,
          name: this.name,
          code: this.codeinfo.order_code
        }
        disabilityInfoVerify(params).then(ret => {
          if (ret.data.errcode === 0) {
            if (ret.data.data.code === 1) {
              console.log(ret.data.data.data)
              this.formItem = ret.data.data.data
            } else {
              this.$Notice.error({ title: ret.data.data.msg })
            }
            console.log(123)
          } else {
            this.$Notice.error({ title: ret.data.msg })
          }
        })
      } else {
        console.log('有值')
        let a = JSON.parse(obj)
        console.log(a)
        this.formItem = JSON.parse(obj)
      }
    },
    submit () {
      const d = new Date(this.formItem.agc111)
      const resDate = d.getFullYear() + '-' + this.p((d.getMonth() + 1)) + '-' + this.p(d.getDate())
      this.formItem.agc111 = resDate
      console.log(this.formItem)
      if (this.formItem.adc013 !== '5' || this.formItem.adc013 !== '6') {
        if (this.formItem.agc114 === '' || this.formItem.agc114 === null || this.formItem.agc114 === undefined) {
          this.$Notice.error({ title: '自理程度不能为空！' })
        } else {
          let data111 = {
            aac001: this.formItem.aac001,
            code: this.codeinfo.order_code
          }
          console.log(data111)
          repetitionApply(data111).then(ret => {
            if (ret.data.errcode === 0) {
              if (ret.data.data.code === 1) {
                // console.log(ret.data.data.data)
                this.$Notice.success({ title: '保存成功！' })
                this.$emit('form', this.formItem)
              } else {
                console.log(ret.data.data.msg)
                this.$Notice.error({ title: ret.data.data.msg })
              }
            }
          })
        }
      } else {
        let data222 = {
          aac001: this.formItem.aac001,
          code: this.codeinfo.order_code
        }
        repetitionApply(data222).then(ret => {
          if (ret.data.errcode === 0) {
            if (ret.data.data.code === 1) {
              // console.log(ret.data.data.data)
              this.$Notice.success({ title: '提交成功！' })
              this.$emit('form', this.formItem)
            } else {
              this.$Notice.error({ title: ret.data.data.msg })
            }
          }
        })
      }
    },
    p (s) {
      return s < 10 ? '0' + s : s
    }

  },
  mounted () {
    // this.init()
  },
  watch: {
    cardno (cardno) {
      if (cardno !== '' || cardno !== null || cardno !== undefined) {
        this.cardNo = cardno
        // console.log(this.cardNo, 99999)
      }
    },
    personinfo (personinfo) {
      if (personinfo !== '' || personinfo !== null || personinfo !== undefined) {
        this.name = personinfo.name
        // console.log(this.name, 88888)
      }
    },
    info (info) {
      this.codeinfo = info
    }
    // formInfo (formInfo) {
    //   this.forminfo = formInfo
    // }
  }
}
</script>

<style scoped>

</style>
